<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SunCMS 后台管理系统</title>
<link href="./images/system/style.css" rel="stylesheet" type="text/css">
<script src="./include/javascript/jquery.js" type="text/javascript"></script>
<script src="./include/javascript/json.js" type="text/javascript"></script>
<script src="./include/javascript/main.js" type="text/javascript"></script>
<script type="text/javascript">
	var SCRIPT='<?php echo SCRIPT_NAME?>';
	var SITE_URL='<?php echo SITE_URL?>';

	var catDel = {
		_saving: false,
		_documentHandle: null,		//文档处理方式
		_categoryChildHandle: null,	//子栏目处理方式
		init: function()
		{
			/** todo: 删除初始化 **/
			if(this._saving==true) return false;
			if(this._check()==false) return false;

			this._saving = true;
			
			parent.dialog.alert('正在删除中。。。<br>如果您选择了删除文档，时间可能会久一点，请耐心等待！',1);

			var catid = $("#catid").val();
			var model = $("#model").val();
			var documentMoveId = $.trim($("#doc_move_id").val());
			var childCategoryMoveId = $.trim($("#child_move_id").val());

			$.ajax({
				url: SITE_URL+SCRIPT+"?m=document&a=category&do=delete",
				data: {'catid':catid,'model':model,'dochandle':this._documentHandle,'docmoveid':documentMoveId,'childhandle':this._categoryChildHandle,'childmoveid':childCategoryMoveId},
				error: function (xmlHttpRequest, error) {
					catDel._saving = false;
					parent.$("#dialog_alert #msg").text('AJAX数据获取异常！');
				},
				success: function(rs)
				{
					if(rs==1)
					{
						parent.frames[0].catMag.getCategoryMenu();
						parent.$("#dialog_alert #msg").text('栏目删除成功！');
					}
					else
					{
						parent.$("#dialog_alert #msg").text('栏目删除失败！');
					}
					catDel._saving = false;
				}
			});
		},
		_check: function()
		{
			if(this._documentHandle == null)
			{
				parent.dialog.alert('请选择栏目文档处理方式！');
				return false;
			}
			else if(this._documentHandle==true && $.trim($("#doc_move_id").val())=='')
			{
				parent.dialog.alert('请选择要转移到的栏目！');
				return false;
			}
			if(this._categoryChildHandle == null)
			{
				parent.dialog.alert('请选择子栏目处理方式！');
				return false;
			}
			else if(this._categoryChildHandle==true && $.trim($("#child_move_id").val())=='')
			{
				parent.dialog.alert('请选择要转移到的栏目！');
				return false;
			}
			return true;
		},
		getMoveToCategory: function(){this._documentHandle==true && global.thumbUpload(2);},
		getMoveToDocument: function(){this._categoryChildHandle==true && global.thumbUpload(2);}
	}
</script>
</head>
<body>

<input type='hidden' id='catid' value='<?php echo $catid; ?>'>
<input type='hidden' id='model' value='<?php echo $model; ?>'>
<input type='hidden' id='doc_move_id'>
<input type='hidden' id='child_move_id'>

<div class="main">
<div class='main_left'>
<div class='main_right'>
<table cellspacing="0" cellpadding="0" border="0" style='height:90%;*height:100%;'>
<tbody>
<tr>
<td valign='top'>
	<table cellspacing="0" cellpadding="0" border="0" style='margin-top:10px;'>
	<tbody>
	<tr>
		<td width='30%' align='right' style='padding-top:15px;'>栏目文档处理：</td>
		<td style='padding-top:15px;'>
			<input name='deldoc' type='radio' value='1' onclick='catDel._documentHandle=false;'>删除 &nbsp;&nbsp;
			<input name='deldoc' type='radio' value='0' onclick='catDel._documentHandle=true;'>转移
		</td>
	</tr>
	<tr>
		<td align='right' style='padding-top:5px;'>转移到：</td>
		<td style='padding-top:5px;'>
			<input class='sinput tp6' type='text' id='doc_move_name' disabled>
			<a class="slbutton" href="javascript:void(0);" onclick="catDel.getMoveToCategory();"><input type="button" class="srbutton" value="..."/></a>
		</td>
	</tr>
	<tr>
		<td align='right' style='padding-top:5px;'>子栏目处理：</td>
		<td style='padding-top:5px;'>
			<input name='delchild' type='radio' value='1' onclick='catDel._categoryChildHandle=false;'>删除 &nbsp;&nbsp;
			<input name='delchild' type='radio' value='0' onclick='catDel._categoryChildHandle=true;'>转移
		</td>
	</tr>
	<tr>
		<td align='right' style='padding-top:5px;'>转移到：</td>
		<td style='padding-top:5px;'>
			<input class='sinput tp6' type='text' id='child_move_name' disabled>
			<a class="slbutton" href="javascript:void(0);" onclick="catDel.getMoveToDocument();"><input type="button" class="srbutton" value="..."/></a>
		</td>
	</tr>
	</tbody>
	</table>
</td>
</tr>
</tbody>
</table>
</div><!--/main_right-->
</div><!--/main_left-->
</div><!--/main-->
<div id="ajaxing" style="padding-top: 5px; background-color: #FFFFCC; position: absolute; z-index: 801; height: 20px; width: 120px; top: 60px;*top:63px; left: 21px;display:none;">
	<img src="./images/system/icon/67.gif"/><font style='color:#008000;' id='ajax_msg'> 正在保存......　</font>
</div>
<input type="submit" style='display:none;' id="sbt" onclick='catDel.init();'>
</body>
</html>